/**
 * Copyright (C) 2021-2022 maminjie <canpool@163.com>
 * SPDX-License-Identifier: LGPL-2.1
 * Powered by Qt-Advanced-Docking-System
**/

#include "dockiconprovider.h"

#include <QVector>

QADS_BEGIN_NAMESPACE

class DockIconProviderPrivate
{
public:
    QVector<QIcon> m_userIcons {QAds::ICON_ROLE_CNT, QIcon()};
};

DockIconProvider::DockIconProvider()
    : d(new DockIconProviderPrivate())
{}

DockIconProvider::~DockIconProvider()
{
    delete d;
}

QIcon DockIconProvider::customIcon(QAds::IconRole role) const
{
    Q_ASSERT(role < d->m_userIcons.size());
    return d->m_userIcons[role];
}

void DockIconProvider::registerCustomIcon(QAds::IconRole role, const QIcon &icon)
{
    Q_ASSERT(role < d->m_userIcons.size());
    d->m_userIcons[role] = icon;
}

QADS_END_NAMESPACE
